<template>
    <div class="box">
        <div class="row shadow">
            <div class="item">
                <img src="../../assets/image/index/home-icon1.png" alt />
                <div class="txt">
                    <div class="num">{{no_exam_count}}</div>
                    <div class="key">未审核需求</div>
                </div>
            </div>
            <div class="item">
                <img src="../../assets/image/index/home-icon2.png" alt />
                <div class="txt">
                    <div class="num">{{exam_count}}</div>
                    <div class="key">已审核需求</div>
                </div>
            </div>
            <div class="item">
                <img src="../../assets/image/index/home-icon3.png" alt />
                <div class="txt">
                    <div class="num">{{news_count}}</div>
                    <div class="key">发布文章总数</div>
                </div>
            </div>
        </div>
        <div></div>
    </div>
</template>

<script>
import * as apis from "../../api/index/index";

export default {
    name: "charts",
    data() {
        return {
            no_exam_count: "- -",
            exam_count: "- -",
            news_count: "- -"
        };
    },
    methods: {
        getList() {
            apis.getData().then(data => {
                if (data.code) {
                    this.$message({type: "error",message: data.message,duration: 1800});
                    return;
                }
                this.no_exam_count = data.data.no_exam_count;
                this.exam_count = data.data.exam_count;
                this.news_count = data.data.news_count;
            }).catch(() => {
                this.$message({type: "error",message: "获取数据失败!",duration: 1800});
            });
        }
    },
    created() {
        this.getList();
    }
};
</script>

<style scoped>
.shadow {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 7px 0 rgba(0, 0, 0, 0.1);
}

.row {
    padding: 16px;
    display: flex;
    margin-bottom: 24px;
    background: #fff;
}
.row .item {
    display: flex;
    flex: 1;
    align-items: center;
}
.row .item img {
    width: 130px;
    height: 120px;
    margin: 0 20px;
}
.row .item .txt {
    font-size: 42px;
    font-weight: bold;
    line-height: 52px;
    color: #2b3473;
}
.row .item + .item {
    border-left: 2px solid #e7ecf0;
}
.row .item .key {
    font-size: 18px;
    font-weight: 100;
    line-height: 28px;
    color: #9599c9;
}
.row .item .name {
    font-size: 18px;
}

.chartsbox {
    display: flex;
    flex-direction: row;
}
.chartsbox .chart {
    flex: 1;
    height: 500px;
}
</style>
